package com.isunland.managesystem.ui;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BasePagerActivity;
import com.isunland.managesystem.entity.PlanManage;
import com.isunland.managesystem.entity.PlanManageProgress;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: HuXiaoDan
 * 创建时间: 2017/4/25 10:08
 */
public class PlanManagePagerActivity extends BasePagerActivity {

  private PlanManage content;

  @Override protected void onCreate(Bundle arg0) {
    content = (PlanManage) getIntent().getSerializableExtra(PlanManageDetailFragment.EXTRA_VALUE);
    super.onCreate(arg0);
  }

  @Override protected Fragment createFragmentOne() {

    return PlanManageProgressListFragment.newInstance(content);
  }

  @Override protected Fragment createFragmentTwo() {
    //PlanManageProgress progress = (PlanManageProgress) getIntent().getSerializableExtra(
    //    PlanManageDetailFragment.EXTRA_PROGRESSVALUE);
    //return PlanManageDetailFragment.newInstance(content, progress);
    return PlanManageDetailFragment.newInstance(content);
  }

  @Override protected int[] createTitle() {
    return new int[] { R.string.planProgress, R.string.planManage };
  }

  @Override protected void setFixedTitle(boolean isFixedTitle, String fixedTitle) {
    if (content.getPlantitle() != null && !TextUtils.isEmpty(content.getPlantitle())) {
      super.setFixedTitle(true, content.getPlantitle());
    } else {
      super.setFixedTitle(false, "");
    }
  }
}
